package vn.ducquoc.jersey;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.codehaus.jettison.json.JSONObject;

import vn.ducquoc.jersey.domain.Issue;


/**
 * RESTful POJO for {@link Issue}
 * 
 * @author ducquoc
 */
@Path("/issue")
public class IssueRest {

  @GET
  @Produces( { MediaType.APPLICATION_XML, MediaType.TEXT_XML })
  public Issue getXml() {
    Issue issue = new Issue();
    issue.setId(99);
    issue.setSummary("One-line summary");
    issue.setDescription("Actual Result: 20$; yet expected Result: 15$");
    return issue;
  }

  @GET
  @Produces( { MediaType.APPLICATION_JSON })
  public Issue getJson() {
    Issue issue = new Issue();
    issue.setId(99);
    issue.setSummary("One-line summary");
    issue.setDescription("Actual Result: 20$; yet expected Result: 15$");
    //return net.sf.json.JSONObject.fromObject(issue).toString();
    return issue;
  }

}